package com.leetcode.partition4;

import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2021/11/15 9:12
 */
public class LC319灯泡开关 {

    public static int bulbSwitch(int n) {
        return (int) Math.sqrt(n);
    }

    private static int iteration(int n) {
        int count = 0;
        boolean[] bulbs = new boolean[n + 1];
        Arrays.fill(bulbs, true);
        //进行转换
        for (int i = 2; i <= n; i++) {
            for (int j = i; j <= n; j += i) {
                bulbs[j] = !bulbs[j];
            }
        }
        for (int i = 1; i <= n; i++) {
            if (bulbs[i]) count++;
        }
        return count;
    }
}
